package com.hopital5.zhangyz.model;

import com.hopital5.zhangyz.vo.enums.ModelType;
import lombok.*;

import javax.persistence.*;
import java.util.List;

@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Model extends BaseModelAndLongId {
    /**
     * 模块的标题
     */
    private String title;

    /**
     * 父模块
     */
    @ManyToOne
    private Model parent;

    /**
     * 链接地址
     */
    private String url;

    /**
     * 模块编码
     */
    private String code;

    /**
     * 模块图标
     */
    private String icon;

    /**
     * 模块排序
     *
     * @return
     */
    private Integer sort;
    /**
     * 子功能集合
     */
    @OneToMany(mappedBy = "parent")
    private List<Model> children;
    /**
     * 是否是菜单
     */
    @Enumerated(EnumType.STRING)
    private ModelType modelType;
}
